//订阅者
function Watcher(vm, attrName, callback) {
  this.vm = vm
  this.attrName = attrName
  this.val = vm.data[attrName]
  this.callback = callback
  this.get()
}

Watcher.prototype.update = function() {
  this.run()
}
Watcher.prototype.run = function() {
  var newVal = this.vm.data[this.attrName];
  var oldVal = this.val;
  if (oldVal !== newVal) {
    this.val = newVal //将新值替换为旧值
    this.callback.call(this.vm, newVal, oldVal)
  }
}
Watcher.prototype.get = function() {
  WatchersContainer.target = this
  this.vm.data[this.attrName]
  WatchersContainer.target = null
}